package com.shiguiwu.springmybatis.mybatis.mapper;

import com.shiguiwu.springmybatis.mybatis.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @description: bookmpper
 * @author: stone
 * @date: Created by 2021/6/21 19:23
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.mybatis
 */
public interface BookMapper {

    /**
     * 新增
     *
     * @param book
     */
    int insert(Book book);

    @Select("select CONCAT('%', #{test}, '%')")
    String testSql(String test);


    void batchInsert(List<Book> books);


    void insertBatch(@Param("books") List<Book> books);

    int update(Book book);

    int batchUpdate(Book book);

    int updateByMap(Map<String, Object> map);

    @Delete("delete from book where id =#{id} ")
    int delete(Integer id);


    int deleteByMap(Map<String, Object> map);

    List<Book> list(Map<String, Object> map);

    List<Book> getBookList();

    List<Book> getBookListPlus();

    List<Book> findAllByBookName(@Param("bookName") String bookName);


}
